home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revista CD Expert 32
/
CD Expert nº 32.iso
/
Army Men TiS
/
data1.cab
/
Required_Files
/
rules
/
koth_ai.txt
< prev
next >
Wrap
Text File
|
1999-10-08
|
4KB
|
123 lines
// these macros get expanded on the host if the @1 army is AI controlled
// @1 = color of army to do AI for, @2 = enemy color,
// @3 = this colors owner number, @4 = enemy colors owner numbers
// @5 = action number for attcking this enemy
macro koth_enemy_ai 5
{
if @1TakeHill testvar hillowner = @4 then
setvar @1Action @5,
order @1sarge1 follow @2sarge1 inmode attack,
order @1 group 1 follow @1sarge1 inmode defend,
order @1 group 2 follow @2sarge1 inmode attack,
order @1 group 3 follow @2sarge1 inmode attack,
order @1 group 4 follow @2sarge1 inmode attack,
order @1 group 5 follow @2sarge1 inmode attack,
trigger @1StartTimeOut
}
// @1 = color of army to do AI for, @2-@4 = other colors,
// @5 = this colors owner number, @6-8 = other colors owner numbers
macro koth_ai_macro 8
{
// This variable holds the current action for @1
// 0 means no action, 1 means goto hill, 2 means get powerups, 3 means defend hill,
// 4 means attack @2 sarge, 5 means attack @3 sarge, 6 means attack @4 sarge
variable @1Action 0
expand koth_enemy_ai ( @1 @2 @5 @6 4 )
expand koth_enemy_ai ( @1 @3 @5 @7 5 )
expand koth_enemy_ai ( @1 @4 @5 @8 6 )
if startup1 then
triggerdelay 1000 @1ChooseNewAction,
triggerdelay 2000 @1RegularOrders
if @1ChooseNewAction then
setvar @1Action 0,
trigger @1CheckIfOnHill,
trigger @1CheckIfHillEmpty,
trigger @1ChoseAction
// if it's time to choose a new action but we are currently owning the hill then
// we should always stay on the hill
if @1CheckIfOnHill testvar @1Action = 0 and hillowner = @5 then
trigger @1DefendHill
// if it's time to choose a new action and the hill is not owned then head straight for it
if @1CheckIfHillEmpty testvar @1Action = 0 and hillowner = 0 then
trigger @1GotoHill
// if @1 has no current action then pick an action
// ideally we would base this on how well armed we are
if @1ChooseAction testvar @1Action = 0 then random
trigger @1TakeHill,
trigger @1GetPowerUps
// these events setup the @1Action variable and do the actions
if @1GotoHill then
setvar @1Action 1,
order @1sarge1 goto @1hill inmode attack,
order @1 group 1 follow @1sarge1 inmode defend,
order @1 group 2 goto @1hill inmode attack,
order @1 group 3 goto @1hill inmode attack,
order @1 group 4 goto @1hill inmode attack,
order @1 group 5 goto @1hill inmode attack,
trigger @1StartTimeOut
if @1GetPowerUps then
setvar @1Action 2,
order @1sarge1 goto @1hill inmode attack,
order @1 group 1 follow @1sarge1 inmode defend,
order @1 group 2 goto @1hill inmode attack,
order @1 group 3 goto @1hill inmode attack,
order @1 group 4 goto @1hill inmode attack,
order @1 group 5 goto @1hill inmode attack,
trigger @1StartTimeOut
if @1DefendHill then
setvar @1Action 3,
order @1sarge1 goto @1hill inmode attack,
order @1 group 1 follow @1sarge1 inmode defend,
order @1 group 2 goto @1hill inmode defend,
order @1 group 3 goto @1hill inmode defend,
order @1 group 4 goto @1hill inmode defend,
order @1 group 5 goto @1hill inmode defend,
trigger @1StartTimeOut
// these events chose a new action if we get on the hill
if hillOwnerChanged then
trigger @1ChooseNewAction
// these events choose new actions if a sarge is killed
if killed @1sarge1 then
triggerdelay 5000 @1GetPowerups
// these are the standing order regardless of what mode sarge is in
if @1RegularOrders then
order @1 group 7 goto @1base inmode defend,
triggerdelay 5000 @1RegularOrders
// timeout code - if mode has not changed for a while then change it
variable @1TimeOutVar 0
variable @1LastTimeOutVar 1
if @1StartTimeOut then
addvar @1TimeOutVar 1,
triggerdelay 120000 @1CheckTimeOut
if @1CheckTimeOut testvar @1TimeOutVar = @1LastTimeOutVar then
trigger @1ChooseNewAction
if @1CheckTimeOut testvar @1TimeOutVar <> @1LastTimeOutVar then
addvar @1LastTimeOutVar 1
}